package cn.weiyang.biz;

import cn.weiyang.dao.EmpDao;
import cn.weiyang.model.Emp;

import java.util.List;

/**
 * 完成员工的增删改查操作
 * Created by Administrator on 2017/7/14.
 */
public class EmpBizImpl implements EmpBiz{
    private EmpDao empDao;

    public EmpDao getEmpDao() {
        return empDao;
    }

    public void setEmpDao(EmpDao empDao) {
        this.empDao = empDao;
    }

    public void addEmp(Emp emp) {
        empDao.addEmp(emp);
    }

    public void delEmp(int empid) {
        empDao.delEmp(empid);
    }

    public void updateEmp(Emp emp) {
        empDao.updateEmp(emp);
    }

    public Emp get(int empid) {
        return empDao.get(empid);
    }

    public List<Emp> searchEmp(Emp emp) {
        return empDao.searchEmp(emp);
    }

    public List<Emp> searchEmp(String hql) {
        return empDao.searchEmp(hql);
    }
    public void addEmps(List<Emp> emps) throws Exception{
        try {
            for(Emp emp:emps){
                empDao.addEmp(emp);
            }
        }catch (Exception e){
            throw new RuntimeException();
        }
    }
}
